﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo01
{
    enum SupNPC
    { 
        任务NPC,
        商贩NPC,
        铁匠NPC
    }
    class Program
    {
        static void Main(string[] args)
        {
            NPCFather npc1 = new TaskNPC("A","送信NPC");
            NPCFather npc2 = new BusinessNPC("B","武器NPC");
            NPCFather npc3 = new IronyNPC("C","修补NPC");

            NPCSpeak(npc1);
            Console.WriteLine();
            NPCSpeak(npc2);
            Console.WriteLine();
            NPCSpeak(npc3);

        }
        static void NPCSpeak(NPCFather n)
        {
            n.Intro();
            n.Speak();
        }
    }

    interface ISpeak
    {
        void Speak();
        void Intro();
    }
    abstract class NPCFather : ISpeak
    {
        private string _NPCName;
        private string _NPCSubType;

        public string NPCName { get => _NPCName; set => _NPCName = value; }
        public string NPCSubType { get => _NPCSubType; set => _NPCSubType = value; }

        protected NPCFather(string NPCName, string NPCSubType)
        {
            _NPCName = NPCName;
            _NPCSubType = NPCSubType;
        }

        public NPCFather()
        {

        }

        public abstract void Speak();
        public virtual void Intro()
        {
            Console.WriteLine($"my NPCSubType is {this.NPCSubType},my name is {this.NPCName}");
        }
    }

    class TaskNPC : NPCFather
    {
        public const SupNPC supType = SupNPC.任务NPC;

        public TaskNPC(string NPCName, string NPCSubType) : base(NPCName,NPCSubType)
        {

        }
        public override void Speak()
        {
            Console.WriteLine("you get a task,you want accept?");
        }

        public override void Intro()
        {
            base.Intro();
            Console.WriteLine($"my super Type is {supType.ToString()}");
        }
    }
    class BusinessNPC : NPCFather
    {
        public const SupNPC supType = SupNPC.商贩NPC;

        public BusinessNPC(string NPCName, string NPCSubType) : base(NPCName, NPCSubType)
        {

        }
        public override void Speak()
        {
            Console.WriteLine("you want some gooods?");
        }
        public override void Intro()
        {
            base.Intro();
            Console.WriteLine($"my super Type is {supType.ToString()}");
        }
    }

    class IronyNPC : NPCFather
    {
        public const SupNPC supType = SupNPC.铁匠NPC;

        public IronyNPC(string NPCName, string NPCSubType) : base(NPCName, NPCSubType)
        {

        }
        public override void Speak()
        {
            Console.WriteLine("you want do something on your weapons?");
        }
        public override void Intro()
        {
            base.Intro();
            Console.WriteLine($"my super Type is {supType.ToString()}");
        }
    }
}
